/*
Spotter Exercise Manager
Copyright 2011 Evan Nelson.

This file is part of Spotter Exercise Manager.

Spotter Exercise Manager is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Spotter Exercise Manager is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Spotter Exercise Manager.  If not, see <http://www.gnu.org/licenses/>.

The author can be contacted by emailing ean5533@gmail.com
*/

#ifndef DATABASE_H
#define DATABASE_H

#include <QSqlDatabase>
#include <QSqlQuery>
#include <QFile>

class Database
{

public:
    static bool openDatabase();
    static void closeDatabase();
    static void createDatabase(bool useSampleData);
    static QString getDBFilePath();
    static bool executeScript(QFile* file);
    static QSqlQuery* prepareQuery(const QString &sQuery);

    static int getCurPersonID();
    static void setCurPersonID(int personID);


protected:
    Database();
    Database(const Database&);
    Database& operator= (const Database&);

private:
    static Database* instance();
    static Database* pInstance;
    QSqlDatabase db;
    int curPersonID;

};

#endif // DATABASE_H
